#!/bin/bash

set_env()
{
    if [ -n "$1" ] ; then #not null
        echo "-- info, set_env set p2pcpp_home=$1"
        export p2pcpp_home=$1

        which p2pcpp
        if [ $? -ne 0 ] ; then
            export PATH=$p2pcpp_home/bin:$PATH
        fi

        which p2pcpp
        if [ $? -ne 0 ] ; then
            echo "-- error,not found p2pcpp,please check path $p2pcpp_home/bin"
        fi
    fi

    bin_dir=$p2pcpp_home/bin
    etc_dir=$p2pcpp_home/etc
    cache_dir=$p2pcpp_home/etc

    log_dir="$p2pcpp_home/log/$HOSTNAME"
    mkdir -p $log_dir
    mkdir -p $cache_dir
    mkdir -p $etc_dir

    export PATH=$bin_dir:$PATH
}




